package com.dominator.utils.system;

import java.util.HashMap;
import java.util.Map;

/**
 * 分页对象
 * @author gsh
 *
 */
public class Pager {
	Integer pageIndex; // 当前页
	Integer pageSize=10; // 页大小
	Integer rowCount; // 总记录数
	Integer pageCount; // 总页数
	Integer start; // 开始位置
	Map<String,Object> data=new HashMap<String,Object>(); //用于存储其它数据

	
	public Map<String, Object> getData() {
		return data;
	}

	public void putData(String key,Object value) {
		data.put(key, value); 
	}

	public Pager(int _pageIndex, int _pageSize) {
		this.pageIndex = _pageIndex;
		this.pageSize = _pageSize;
	}

	public Integer getPageIndex() {
		return pageIndex;
	}

	public void setPageIndex(Integer pageIndex) {
		this.pageIndex = pageIndex;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Integer getRowCount() {
		return rowCount;
	}

	public void setRowCount(Integer rowCount) {
		this.rowCount = rowCount;
		try {
			this.pageCount = rowCount / pageSize + (rowCount%pageSize>0?1:0);
		} catch (Exception ex) {

		}
	}

	public Integer getPageCount() {
		return pageCount;
	}

	public Integer getStart() {
		try {
			start = (pageIndex - 1) * pageSize;
		} catch (Exception ex) {
		}
		return start;
	}
}
